package com.upup.cloud.insert.service.impl;

import com.upup.cloud.insert.entity.Qnracess;
import com.upup.cloud.insert.service.QnracessRepositoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Service;

@Service
public class QnracessRepositoryServiceImpl implements QnracessRepositoryService {
    @Autowired
    private MongoTemplate mongoTemplate;
    @Override
    public void save(Qnracess qnracess) {
        mongoTemplate.save(qnracess);
    }

    @Override
    public Qnracess findById(String id) {
        Query query=new Query(Criteria.where("id").is(id));
        Qnracess user =  mongoTemplate.findOne(query , Qnracess.class);
        return user;
    }
}